package com.birdpiss.commons.utils;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * The Class NumberUtils.
 *
 * @author mark
 */
public class NumberUtils {

	/**
	 * Gets the big decimal.
	 *
	 * @param number the number
	 *
	 * @return the big decimal
	 */
	public static BigDecimal getBigDecimal(String number) {
		if (number == null) return null;
		return setBigDecimalCurrencyScale(new BigDecimal(number));
	}

	/**
	 * Sets the big decimal currency scale.
	 *
	 * @param number the number
	 *
	 * @return the big decimal
	 */
	public static BigDecimal setBigDecimalCurrencyScale(BigDecimal number) {
		if (number == null) return null;
		return number.setScale(2, RoundingMode.DOWN);
	}

}
